package com.xiaoshuidi.cloud.module.iot.dal.repository;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaoshuidi.cloud.module.iot.dal.mapper.DevicePriceMapper;
import com.xiaoshuidi.cloud.module.iot.dal.pojo.DevicePrice;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

/**
 * @BelongsProject: lease-module-iot
 * @BelongsPackage: spring.cloud.sdiot.callback.dataaccess.impl
 * @Author: James
 * @CreateTime: 2023-06-15  09:52
 * @Description: TODO
 * @Version: 1.0
 */
@Repository
@Slf4j
public class DevicePriceRepository extends ServiceImpl<DevicePriceMapper, DevicePrice> {


    public DevicePrice getDevicePriceVo(Long year, String deviceNo) {
        LambdaQueryWrapper<DevicePrice> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(DevicePrice::getYear, year)
                .eq(DevicePrice::getDeviceNo, deviceNo);
        return getOne(wrapper);
    }
}
